import { axios } from '@/utils/request'

export function fetchList (params) {
  return axios({
    url: '/product/page',
    method: 'GET',
    params
  })
}

export function getObj (id) {
  return axios({
    url: '/product/info/' + id,
    method: 'GET'
  })
}

export function addObj (obj) {
  return axios({
    url: '/product/add',
    method: 'POST',
    data: obj
  })
}

export function putObj (obj) {
  return axios({
    url: '/product/update',
    method: 'PUT',
    data: obj
  })
}

export function delObj (id) {
  return axios({
    url: '/product/' + id,
    method: 'DELETE'
  })
}

export function downloadModel () {
  return axios({
    url: '/product/downloadTemplate',
    method: 'get',
    responseType: 'arraybuffer'
  })
}